package com.kust.staticService.controller;


import com.kust.commomUtils.Result;
import com.kust.staticService.service.DailyService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * <p>
 * 网站统计日数据 前端控制器
 * </p>
 *
 * @author testjava
 * @since 2022-07-06
 */
@RestController
@RequestMapping("/staticService/daily")
public class DailyController {

    @Autowired
    private  DailyService dailyService;

    @ApiOperation("统计某一天注册人数，生成统计数据")
    @PostMapping("registerCount/{day}")
    public Result registerCount(@PathVariable("day") String day){
        dailyService.registerCount(day);
        return Result.ok();
    }

    @GetMapping("show-chart/{begin}/{end}/{type}")
    public Result showChart(@PathVariable String begin,@PathVariable String end,@PathVariable String type){
        Map<String, Object> map = dailyService.getChartData(begin, end, type);
        return Result.ok().data(map);
    }
}

